<?php

/**
 * cmsField form base class.
 *
 * @method cmsField getObject() Returns the current form's model object
 *
 * @package    cms
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasecmsFieldForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'tab'          => new sfWidgetFormInputText(),
      'col'          => new sfWidgetFormInputText(),
      'relation'     => new sfWidgetFormInputText(),
      'value'        => new sfWidgetFormInputText(),
      'max_length'   => new sfWidgetFormInputText(),
      'type_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('cmsFieldType'), 'add_empty' => false)),
      'subtype'      => new sfWidgetFormInputText(),
      'menu_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('cmsFieldMenu'), 'add_empty' => false)),
      'allow_search' => new sfWidgetFormInputCheckbox(),
      'allow_header' => new sfWidgetFormInputCheckbox(),
      'allow_row'    => new sfWidgetFormInputCheckbox(),
      'allow_form'   => new sfWidgetFormInputCheckbox(),
      'allow_show'   => new sfWidgetFormInputCheckbox(),
      'is_controle'  => new sfWidgetFormInputCheckbox(),
      'is_active'    => new sfWidgetFormInputCheckbox(),
      'position'     => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'tab'          => new sfValidatorString(array('max_length' => 63, 'required' => false)),
      'col'          => new sfValidatorString(array('max_length' => 63, 'required' => false)),
      'relation'     => new sfValidatorString(array('max_length' => 63, 'required' => false)),
      'value'        => new sfValidatorString(array('max_length' => 63)),
      'max_length'   => new sfValidatorInteger(array('required' => false)),
      'type_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('cmsFieldType'))),
      'subtype'      => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'menu_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('cmsFieldMenu'))),
      'allow_search' => new sfValidatorBoolean(array('required' => false)),
      'allow_header' => new sfValidatorBoolean(array('required' => false)),
      'allow_row'    => new sfValidatorBoolean(array('required' => false)),
      'allow_form'   => new sfValidatorBoolean(array('required' => false)),
      'allow_show'   => new sfValidatorBoolean(array('required' => false)),
      'is_controle'  => new sfValidatorBoolean(array('required' => false)),
      'is_active'    => new sfValidatorBoolean(array('required' => false)),
      'position'     => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('cms_field[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'cmsField';
  }

}
